import request from '@/utils/request'

// 查询物料计划列表
export function listMtrplan(query) {
  return request({
    url: '/mes/mtrplan/mtrPlanList',
    method: 'get',
    params: query
  })
}

// 查询物料计划详细
export function getMtrplan(id) {
  return request({
    url: '/mes/mtrplan/' + id,
    method: 'get'
  })
}

// 新增物料计划
export function addMtrplan(data) {
  return request({
    url: '/mes/mtrplan',
    method: 'post',
    data: data
  })
}

// 修改物料计划
export function updateMtrplan(data) {
  return request({
    url: '/mes/mtrplan',
    method: 'put',
    data: data
  })
}

// 删除物料计划
export function delMtrplan(id) {
  return request({
    url: '/mes/mtrplan/' + id,
    method: 'delete'
  })
}
//生成采购需求
export function createBuyNeed(id) {
  return request({
    url: '/mes/mtrplan/createBuyNeed',
    method: 'post',
    params:id
  })
}
//查询物料计划详情
export function getDetails(id){
  return request({
    url: '/mes/mtrplan/getDetails',
    method: 'get',
    params:id
  })
}

//撤回
export function revokePlanAndNeed(id){
  return request({
    url: '/mes/mtrplan/revokePlanAndNeed',
    method: 'delete',
    params:id
  })
}

